﻿<!--suppress ALL -->
<include file="./Template/header.html" />


<link rel="stylesheet" type="text/css" href="/Template/css/checkin.css?v=6">

<script type="text/javascript">



    $(function() {

        //初始化页面配置
        initPage("马蹄足专区");

        var app = new Vue({
            el: '#container',
            data: {
                finishedProductList: [],
            },
            methods: {
                link: function(id) {
                    if(id == 1){
                        window.location.href = "/wechat/clubfoot/myIcoin";
                    }
                    if(id == 2){
                        window.location.href = "/wechat/clubfoot/faq";
                    }
                    if(id == 3){
                        window.location.href = "/wechat/clubfoot/checkin";
                    }
                },
                chart: function() {
                    if("{$customer.valid}" == -1){
                        if(!confirm("访问[穿戴记录]需要先完善个人资料，是否跳转到[个人资料]页面？")){
                            return false;
                        }else{
                            window.location.href = "/wechat/userCenter/myInfo";
                        }
                    }else{
                        window.location.href = "/wechat/clubfoot/chart";
                    }
                },
                updateInfo: function() {
                    window.location.href = "/wechat/userCenter/myInfo";
                },
                dailyCheckin: function() {
                    $.ajax({
                        url: "/wechat/clubfoot/dailyCheckin",
                        type: "post",
                        data: {},
                        dataType: "JSON",
                        beforeSend: function () {
                            $("#loadingToast").show();
                        },
                        complete: function () {
                            $('#loadingToast').hide();
                        },
                        success: function (data) {
                            if (data.code == 100) {
                                alert("穿戴开始");
                                window.location.href = "/wechat/clubfoot/checkin";
                            }
                            if (data.code == 200) {
                                alert("穿戴结束");
                                window.location.href = "/wechat/clubfoot/checkin";
                            }
                        },
                    })
                },
                iowaOrder: function() {
                    window.location.href = "/wechat/finishedProduct/finishedOrder/id/1";
                },
                ponsetiOrder: function() {
                    window.location.href = "/wechat/clubfoot/ponseti";
                },
                order: function(id) {
                    window.location.href = "/wechat/order/index/id/"+id;
                },
                guarantee: function() {
                    window.location.href = "/wechat/clubfoot/guarantee";
                },
                orderList: function() {
                    window.location.href = "/wechat/finishedProduct/orderList";
                },
                customerService: function () {
                    $(".subscribe").show();
                },
                closeCustomerService: function () {
                    $(".subscribe").hide();
                }
            }
        })
        function freshCheckin() {
            $.ajax({
                url: "/wechat/clubfoot/freshCheckin",
                type: "post",
                data: {},
                dataType: "JSON",
                beforeSend: function () {
                    $("#loadingToast").show();
                },
                complete: function () {
                    $('#loadingToast').hide();
                },
                success: function (data) {
                    if (data.code == 200) {
                        alert("上次打卡未关闭");
                        window.location.href = "/wechat/clubfoot/checkin";
                    }
                },
            })
        }
        function getClubfootProductList(classId, keyword) {

            $.ajax({
                url:"/wechat/clubfoot/clubfootProductList",
                type:"post",
                data:{
                    classId: classId,
                    keyword: keyword
                },
                dataType:"JSON",
                beforeSend:function(){
                    $("#loadingToast").show();
                },
                complete:function(){
                    $('#loadingToast').hide();
                },
                success:function(data){
                    app.finishedProductList = data;
                    setTimeout(function() {
                        $(".ui-item.measure-info img").bind("click", function() {
                            var upUrl = "/Template/images/icon-up.png";
                            var downUrl = "/Template/images/icon-down.png";
                            $(this).parent().next().toggle();
                            if($(this).attr("src") == upUrl) {
                                $(this).attr("src", downUrl);
                            } else {
                                $(this).attr("src", upUrl);
                            }
                        });
                        $(".ui-item.measure-info img").each(function() {
                            $(this).trigger("click");
                        });
                    },200);
                },
            })
        }
//        getClubfootProductList("{$classId}","{$keyword}");
//        $(".search-box").change(function() {
//            var value = $(this).find("option:selected").text();
//            $(this).prev().attr('placeholder',value);
//        });
//
//
//        $("select[name=classId]").change(function() {
//
//            var classId = $(this).val();
//            var keyword = $("input[name=keyword]").val();
//            getClubfootProductList(classId,keyword);
//
//        });
//
//        $("input[name=keyword]").change(function() {
//            var classId = $("select[name=classId]").val();
//            var keyword = $(this).val();
//            getClubfootProductList(classId, keyword);
//
//        });
//
//        $("img[name=searchImg]").click(function() {
//
//            var classId = $("select[name=classId]").val();
//            var keyword = $("input[name=keyword]").val();
//            getClubfootProductList(classId, keyword);
//
//        });
        $("select[name=chartId]").change(function() {
            window.location.href = "/wechat/clubfoot/chart/id/"+$(this).val();
        });
//        freshCheckin();
    });


</script>
<div class="container" id="container" style="background-color: #ffffff">
    <div class = "search">
        <div class="class-search">
            <div>
                <span class="class-start">上次开始时间：</span><span class="class-time">{$info.checkin_time}</span>
            </div>
            <div>
                <span class="class-duration">今日穿戴时长：</span><span class="class-time">{$info.duration}</span>
            </div>
            <div>
                <button class="info-button" v-on:click="chart()">穿戴记录</button>
                <if condition="$info['checkin_type'] eq '0'">
                    <button class="info-start-button" v-on:click="dailyCheckin()">开始穿戴</button>
                </if>
                <if condition="$info['checkin_type'] eq '1'">
                    <button class="info-stop-button" v-on:click="dailyCheckin()">停止穿戴</button>
                </if>
            </div>
        </div>



    </div>

    <div class="qiandao-bottom">
        <div class="qiandao-rule-list">
            <h4>穿戴打卡规则介绍：</h4>
            <p>·为宝宝穿戴好支具点击绿色‘开始穿戴’按钮</p>
            <p>·为宝宝脱下支具时点击红色‘停止穿戴’按钮</p>
            <p>·按钮自动切换，每日可多次开始和停止，时间将累计</p>
            <p>·若穿戴时间跨越零点，穿戴时间将分别累计到前后两天</p>
            <p>·每日穿戴时间最大为24小时，低于12小时视为无效数据</p>
        </div>
        <!--div class="qiandao-rule-list">
            <h4>其他规则：</h4>
            <p>1. 首次完善个人资料，并填写实际信息将获得50个I币奖励。</p>
            <p>2. 推荐好友加入“马蹄足交流答疑群”并且该好友成功购买IOWA支具后，推荐者将获得200个I币奖励。</p>
            <p>3. 在“马蹄足交流答疑群”中热心帮助其他病友解决问题并且得到专家认可，每月将获得50个<img class="qiandao-coin" src="/Template/images/icon-icoin.png">币奖励。</p>
            <p>3. 获得的奖励不能直接提现，只能在购买IOWA支具或配件是使用，在消费时1个I币可以抵1元现金使用。</p>
        </div-->
    </div>
    <div class="content-left">
        <div class="bg-img" v-on:click="order(2)">
            <img src="/Template/images/orderIowa.png" alt="">
        </div>
    </div>
    <div class="content-right">
        <div class="bg-img" v-on:click="guarantee()">
            <img src="/Template/images/guarantee.png" alt="">
        </div>
    </div>
    <div class="content-left">
        <div class="bg-img" v-on:click="link(1)">
            <img src="/Template/images/myicoin.png" alt="">
        </div>
    </div>
    <div class="content-right">
        <div class="bg-img" v-on:click="link(2)">
            <img src="/Template/images/faq.png" alt="">
        </div>
    </div>
    <div>
        <button class="bottom-button"></button>
    </div>
    <div class="chart-info" v-on:click="ponsetiOrder()">
        <div class="item">
            <span>购买潘塞缇方法相关模型</span>
            <img class="icon-right" src="/Template/images/icon-right.png" alt="">
        </div>
    </div>
    <if condition="$agentId[0] gt 0" >
        <div class="chart-info" v-on:click="iowaOrder()">
            <div class="item">
                <span>iowa支具快速下单</span>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
        </div>

    </if>

    <if condition="$job[0] eq 100" >
        <div class="chart-info" v-on:click="orderList()">
            <div class="item">
                <span>成品订单历史查询</span>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
        </div>
        <div class="chart-info">
            <div class="item">
                <span>查看用户打卡情况：</span>
                <input id="chartId" type="text" value="" readonly placeholder="请选择用户">
                <select name="chartId">
                    <option value="">请选择</option>
                    {:getChartSelectOptionHtml(0,0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
        </div>
    </if>

    <div v-on:click="customerService()">
        <div id="message" class="message">
            <img class="message-pic-back" src="/Template/images/icon-message-back.png" alt="">
        </div>
        <div id="message" class="message">
            <img class="message-pic" src="/Template/images/icon-service.png" alt="">
        </div>
    </div>
    <div class="subscribe" style="display: none">
        <div class="pop-frame">
            <!--div class="hint">
                <div class="line"></div>
                <p class="rec-title">无法识别二维码?</p>
                <ul>
                    <li>1、打开微信,点击添加朋友</li>
                    <li>2、搜索微信号:xwkkffj</li>
                    <li>3、点击”关注”,完成</li>
                </ul>
            </div-->
        </div>
        <div class="two-d-code">
            <img class="two-d-code-bg" src="/Template/images/doc-2d-code-bg.png" alt="">
            <img class="two-d-code-img" src="/Template/images/customer-service-qrcode.png" alt="">
            <p class="recognize">
                <br/>
                长按图片[识别二维码]添加客服微信
                <br/>
                <button v-on:click="closeCustomerService()">关闭</button>
            </p>

        </div>
    </div>
</div>

<include file="./Template/footer.html" />

